<?php require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
require_once($GLOBALS['PAD']."Modules/FJK46JDE/modconf.php");
MYTCONN();
	$memberID = 0;
	if (isset($_GET['RSID'])) { 
		$GETDATA = $GLOBALS['MYT']->db_array("SELECT * FROM systemoffice.timeclock_staffoff
			WHERE tsv_ID = {$_GET['RSID']}");
		$memberID = $GETDATA[1]['tsv_Member'];
		$_GET['SMID'] = $memberID;
		if ($GETDATA[1]['tsv_Process'] == 397 || $GETDATA[1]['tsv_Process'] == 399 || $GETDATA[1]['tsv_Process'] == 401) {
			$GETDATA[1]['tsv_Type'] = 1;
		} else {
			$GETDATA[1]['tsv_Type'] = 2;
		}
	} else {
		$GETDATA[1]['tsv_Type'] = 1;
		$GETDATA[1]['tsv_DateStart'] = '';
		$GETDATA[1]['tsv_DateEnd'] = '';
		$GETDATA[1]['tsv_Observations'] = '';
	}
	if (isset($_GET['trsf_Member'])) { $memberID = $_GET['trsf_Member']; }

	form_pr('staffoff','','','post');
	mn_field('hidden','ED','tsv_ID',0,'','','','');
	echo '<div style="height:440px;">
	<div id="SelcMember" class="Line">';
	if ($memberID == 0) { 
		include($MODPAD.'Lib/sel_memberrsm.php');
	} else {
		include($MODPAD.'Lib/get_memberrsm.php');
	}
	echo '</div>';
	
	echo '<table>
	<tr><td>Tipo de Dispensa:</td><td>';
	mn_field('hselect','ED','tsv_Type',$GETDATA[1]['tsv_Type'],'Ferias;Baixa#1;2','','','');
	echo '</td></tr>
	<tr><td colspan="2">
	<b> Periodo</b>
	</td></tr>
	<tr><td>';
	echo 'Inicia a: </td><td>'; mn_field('date','ED','tsv_DateStart',$GETDATA[1]['tsv_DateStart'],'staffoff','8','False','');
	echo '</td></tr><tr><td>';
	echo 'Termino a: </td><td>'; mn_field('date','ED','tsv_DateEnd',$GETDATA[1]['tsv_DateEnd'],'staffoff','8','False','');	 
	echo '</td></tr><tr><td style="vertical-align:top">';	 
	echo 'Observacoes</td><td>'; mn_field('textarea','ED','tsv_Observations',$GETDATA[1]['tsv_Observations'],'70','15','False','');	 
	echo '</td></tr></table>
	</div>';

 mn_field('button','ED','Save','Guardar','','','','" style="width:100%;height:20" onClick="
 if (typeof(document.staffoff.MemberID) == \'undefined\') {
		alert(\'Tem de escolher um funcionario.\');	
	} else if (document.staffoff.tsv_DateStart.value > document.staffoff.tsv_DateEnd.value) {
		alert(\'O periodo indicado nao e valido.\');	
	} else {
	document.staffoff.action=\''.$GLOBALS['URL'].'_response/rsproxy.php?pr=rh_memberoff\';
	subform(\'staffoff\',\'pr_user\');
	}'); ?>
</form>